
Use Tunga;

GO
--Insert
Alter PROC insertEvents
	@[title] nvarchar(100),
	@[datepost] datetime,
	@[descr] nvarchar(500)
AS
INSERT INTO  Events([title],[datepost],[descr])
 VALUES(@[title],@[datepost],@[descr])


GO
--update
Alter PROC updateEvents
	@[id] int,
	@[title] nvarchar(100),
	@[datepost] datetime,
	@[descr] nvarchar(500)
AS
UPDATE Events SET
	[title] =@[title],
	[datepost] =@[datepost],
	[descr] =@[descr]
WHERE [id]=@[id]
GO
--Delete

CREATE PROC deleteEvents
	@[id] int
AS
	DELETE FROM Events WHERE id=@[id]
GO
--Get All
CREATE PROC getAllEvents
AS
	SELECT * from Events 
GO
--Get Events By ID
CREATE PROC getEventsByID
	@[id] int
AS
	SELECT * from Events WHERE [id]=@[id]
Go
--Check Exist Events
CREATE PROC checkExistEvents
	@[username] nvarchar(100)
AS
SELECT * from Custormer where [username]=@[username]
GO
